<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopUserTaskTarget extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_user_task_target', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger("userId")->default(0)->comment("用户ID");
            $table->unsignedInteger("targetTime")->default(0)->comment("目标记录时间");
            $table->tinyInteger("type")->default(0)->comment("类型默认 0-督导 1-选址");
            $table->unsignedInteger("targetCount")->default(0)->comment("目标数");
            $table->unsignedInteger("finishCount")->default(0)->comment("完成数");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '员工任务目标记录表';

            $table->index('userId', 'idx_userId');
            $table->index('targetTime', 'idx_targetTime');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_user_task_target');
    }
}
